Skip to main content
`Ctrl`+`K`

# ng911ok.lib.geomutils module

_bind_and_call(func: Callable[[_P], _T], /, arg_dict: dict[str, Any]) → _T

  Calls a function with a `dict` of arguments, handling cases like positional-only parameters and variable-length (`*args`/`**kwargs`) parameters.

_calculate_buffer_angles(keep_side: Literal['ALL', 'LEFT', 'RIGHT'] = 'ALL', keep_along: Literal['ALL', 'NEAR', 'FAR'] = 'ALL', angle: float | None = None) → tuple[float, int]

_cast_single_geometry(geom_object: PointGeometry | Point | Multipoint | MultiPoint | Polyline | Polyline | Polygon | Polygon | SpatialReference | SpatialReference, target_type: type[T_Geometry]) → T_Geometry

  Converts a single geom_object between corresponding `arcpy` and `arcgis.geometry` types.

_get_corresponding_geom_type(geom_type: type[PointGeometry | Point | Multipoint | MultiPoint | Polyline | Polyline | Polygon | Polygon | SpatialReference | SpatialReference]) → type[PointGeometry | Point | Multipoint | MultiPoint | Polyline | Polyline | Polygon | Polygon | SpatialReference | SpatialReference]

_get_cutter_lines(line: Polyline | Polyline, distance_meters: float) → tuple[Polyline, Polyline]

  Returns lines for cutting the end-caps off buffers. The cutter lines are oriented such that they are perpendicular to (specifically, 90 degrees to the right of) line The first returned value corresponds to the start point of line and the second to the end point.

_trim_buffer(buffer: T_Polygon, start_cutter: Polyline | Polyline, end_cutter: Polyline | Polyline) → T_Polygon

cast_geometry(match_type_of: str, /, **targets: type[PointGeometry | Point | Multipoint | MultiPoint | Polyline | Polyline | Polygon | Polygon | SpatialReference | SpatialReference]) → Callable[[Callable[[...], PointGeometry | Point | Multipoint | MultiPoint | Polyline | Polyline | Polygon | Polygon | SpatialReference | SpatialReference]], Callable[[...], PointGeometry | Point | Multipoint | MultiPoint | Polyline | Polyline | Polygon | Polygon | SpatialReference | SpatialReference]]

  Similar to `cast_input_geometry()`, but also ensures that the return type of the decorated function matches that of the argument for the parameter named match_type_of.

cast_input_geometry(**targets: type[PointGeometry | Point | Multipoint | MultiPoint | Polyline | Polyline | Polygon | Polygon | SpatialReference | SpatialReference]) → Callable[[Callable], Callable]

  Decorator factory to allow decorated functions to take geometry objects from either the `arcpy` or `arcgis` packages while ensuring that parameters specified in targets will always be of one specific type.

  For example, consider these functions:

      def hopefully_arcpy_polygon(polygon_obj: arcpy.Polygon | arcgis.geometry.Polygon) -> None:
          assert isinstance(polygon, arcpy.Polygon)

      @cast_input_geometry(polygon_obj=arcpy.Polygon)
      def definitely_arcpy_polygon(polygon_obj: arcpy.Polygon | arcgis.geometry.Polygon) -> None:
          assert isinstance(polygon, arcpy.Polygon)

  The function `hopefully_arcpy_polygon` will only succeed if it is called with an instance of `arcpy.Polygon` as the `polygon_obj` argument. The function `definitely_arcpy_polygon`, however will succeed even if `polygon_obj` is an instance of `arcgis.geometry.Polygon` because of the decorator.

  Parameters:

    targets (type[arcpy.Geometry | arcgis.geometry.Geometry]) – Mapping of parameter name(s) in the decorated function to the desired type of each argument

  Returns:

    A decorator

  Return type:

    Callable[[Callable], Callable]

get_end_from_curve(curve_dict: dict[Literal['a', 'b', 'c'], list]) → list[float | None]

  Given a curve dict, returns the endpoint of the curve.

get_midpoint(line_feature: Polyline | Polyline) → PointGeometry

  Returns an `arcpy.PointGeometry` at the midpoint of line_feature.

get_segment(line: T_Polyline, part: int, start_vertex: int, end_vertex: int) → T_Polyline

get_segments(line: T_Polyline, part: int) → list[T_Polyline]

get_vertex(line: Polyline | Polyline, vertex_index: int) → PointGeometry
get_vertex(line: Polyline | Polyline, part_index: int, vertex_index: int) → PointGeometry

meters_between(point1: PointGeometry | Point, point2: PointGeometry | Point, method: Literal['GEODESIC', 'PLANAR', 'GREAT_ELLIPTIC', 'LOXODROME', 'PRESERVE_SHAPE'] = 'GEODESIC') → float

point_beside_line(line_feature: ~arcpy.arcobjects.geometries.Polyline | ~arcgis.geometry._types.Polyline, side: ~typing.Literal['LEFT', 'RIGHT'], distance_meters: float, segment: int = 0, part: int = 0, method: ~typing.Literal['GEODESIC', 'PLANAR', 'GREAT_ELLIPTIC', 'LOXODROME', 'PRESERVE_SHAPE'] = 'GEODESIC', return_as: type[~ng911ok.lib.geomutils.T_PointGeom] = <class 'arcpy.arcobjects.geometries.PointGeometry'>) → T_PointGeom

  Returns a point 90 degrees to either the left or the right of the input line_feature, offset by distance_meters.

polyline_from_point_geometries(*geoms: PointGeometry | Point, spatial_reference: SpatialReference | SpatialReference | None = None) → Polyline

  Convenience method to create an `arcpy.Polyline` with geoms as its vertices. If no spatial_reference is provided, that of the first item in geoms is used.

trim_and_split_buffer(buffer: Polygon | Polygon, line: Polyline | Polyline, buffer_distance_meters: float) → tuple[Polygon, Polygon] | tuple[None, None]